perf(dashboard): lazy-load below-fold dashboard widgets to reduce initial bundle (#966)#984
Conversation
|
@harshitanagpal05 is attempting to deploy a commit to the PRIYANSHU DOSHI's projects Team on Vercel. A member of the Team first needs to authorize it. |
GSSoC Label Checklist 🏷️@Priyanshu-byte-coder — please apply the appropriate labels before merging: Difficulty (pick one):
Quality (optional):
Validation (required to score):
|
Priyanshu-byte-coder
left a comment
There was a problem hiding this comment.
Good performance improvement! Note:
This PR touches the same files as #978 (globals.css, page.tsx, layout.tsx, DashboardHeader.tsx). These will conflict on merge. Please rebase on latest main once the merge order is decided. Also, the globals.css changes (61 additions) appear unrelated to lazy-loading — consider splitting those into a separate PR or explaining the connection.
|
Hi @Priyanshu-byte-coder, I’ve rebased the branch, resolved the conflicts, and cleaned up the unrelated |
…sights to avoid build failures when not installed
ed98332 to
b98db6c
Compare
|
Hi! This PR has a merge conflict with main. Please rebase onto the latest main branch ( |
Summary
Lazy-load chart-heavy and below-the-fold dashboard widgets to reduce the initial JavaScript payload and improve First Contentful Paint (FCP) and Time-to-Interactive (TTI).
This PR replaces eager loading of Recharts-based dashboard widgets with dynamic imports using
next/dynamicand lightweight skeleton fallbacks to improve perceived performance and Lighthouse scores.Why
The dashboard currently loads multiple chart-heavy components eagerly, adding unnecessary JavaScript to the initial bundle even when users never scroll to those sections.
By loading these widgets only when needed:
What Changed
next/dynamic(..., { ssr: false, loading: () => <SkeletonCard /> })Widgets Lazy-Loaded
CodingActivityInsightsCardFriendComparisonActivityRingChartContributionGraphContributionHeatmapPRMetricsPRBreakdownChartCommitTimeChartPRReviewTrendChartImplementation Notes
next/dynamicwithssr: falseso Recharts code is loaded only in the browserFiles Changed
page.tsxHow to Test
Start the development server
Visit:
http://localhost:3000/dashboardVerify:
Validation
Notes
npm run type-checkcurrently reports unrelated missing type declarations for:@vercel/analytics/next@vercel/speed-insights/nextThese are pre-existing environment/type issues and are unrelated to this PR’s lazy-loading changes.
Closes #966